﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class System_EditUserPas : ATPages
{
    protected void Page_Load(object sender, EventArgs e)
    {
     
        if (!IsPostBack)
        {
           
         
            ZSql info = new ZSql();
            username.Text = Server.UrlDecode(Request.Cookies["user"].Values["name"]);
            realname.Text = Server.UrlDecode(Request.Cookies["user"].Values["realname"]);
            department.Text = info.GetScalar("select deptname from department where deptid = " + Request.Cookies["user"].Values["deptid"]).ToString();
            //hfuserid.Value = Server.UrlDecode(Request.Cookies["user"].Values["userid"]);
        }
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        ZSql gg = new ZSql();
        if (pass1.Text == pass2.Text)
        {

            gg.Open("update UserInfo set password= '" + Common.WebEncrypt(pass1.Text) + "' where username='" + username.Text + "'and realname='"+realname.Text+"'");
            Response.Write("<script>alert('密码修改成功');location.href=document.referrer</script>");
        }
        else
        {
         Response.Write("<script>alert('两次输入得密码不一致');location.href=document.referrer</script>");
        }
    }
}
